﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SolrExample.Tests.EasyNetSolr
{
    /// <summary>
    /// The SearchResultOption represent the JobResultOptions section of a item search request.
    /// </summary>
    public class SearchResultOption
    {
        private IList<string> resultColumns = new List<string>();
        private bool includeAllResults = false;
        private int startIndex = 0;
        private int pageSize = 50;
        private int maxNumOfRecordInAllPages = -1;
        private bool returnRowCountOnly;
        private bool enableSearchResultHighlight = false;
        private bool byPassMaximumPageSizeLimit = false;
        private bool useCustomDisplayColumns = false;
        private string fieldChooserName;
        private string highlightFormat = null;

        /// <summary>
        /// Initialize a new instance of SearchResultOption.
        /// </summary>
        public SearchResultOption()
        {

        }

        public string FieldChooserName
        {
            get
            {
                return this.fieldChooserName;
            }
            set
            {
                this.fieldChooserName = value;
            }
        }

        public bool UseCustomDisplayColumns
        {
            get
            {
                return this.useCustomDisplayColumns;
            }
            set
            {
                this.useCustomDisplayColumns = value;
            }
        }

        public bool ByPassMaximumPageSizeLimit
        {
            get
            {
                return this.byPassMaximumPageSizeLimit;
            }
            set
            {
                this.byPassMaximumPageSizeLimit = value;
            }
        }

        /// <summary>
        /// Gets or sets a flag to enable or disable search result highlight.
        /// </summary>
        public bool EnableSearchResultHighlight
        {
            get
            {
                return this.enableSearchResultHighlight;
            }
            set
            {
                this.enableSearchResultHighlight = value;
            }
        }

        /// <summary>
        /// Gets the list of JobSearchColumn.
        /// </summary>
        public IList<string> ResultColumns
        {
            get
            {
                return this.resultColumns;
            }
        }

        /// <summary>
        /// Gets or sets a flag which indicates if all search results should be included or not.
        /// </summary>
        public bool IncludeAllResults
        {
            get
            {
                return this.includeAllResults;
            }
            set
            {
                this.includeAllResults = value;
            }
        }

        /// <summary>
        /// Gets or sets the start index of the search result. It should be used to retreive a specific page of a search result.
        /// </summary>
        public int StartIndex
        {
            get
            {
                return this.startIndex;
            }
            set
            {
                this.startIndex = value;
            }
        }

        /// <summary>
        /// Gets or sets the size of each page in the search result.
        /// </summary>
        public int PageSize
        {
            get
            {
                return this.pageSize;
            }
            set
            {
                this.pageSize = value;
            }
        }

        /// <summary>
        /// Gets or sets a boolean flag which indicates if only the row count instead of the data should be returned.
        /// </summary>
        public bool ReturnRowCountOnly
        {
            get
            {
                return this.returnRowCountOnly;
            }
            set
            {
                this.returnRowCountOnly = value;
            }
        }

        public int MaxNumOfRecordInAllPages
        {
            get
            {
                return this.maxNumOfRecordInAllPages;
            }
            set
            {
                this.maxNumOfRecordInAllPages = value;
            }
        }

        public string HighlightFormat
        {
            get
            {
                return this.highlightFormat;
            }
            set
            {
                this.highlightFormat = value;
            }
        }
    }
}